cmake_minimum_required(VERSION 3.5)

project(QSimpleUpdater VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Widgets Gui Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Gui Network)

add_library(QSimpleUpdater
    include/QSimpleUpdater.h
    src/Downloader.h
    src/Updater.h
    src/Updater.cpp
    src/Downloader.cpp
    src/QSimpleUpdater.cpp
    src/Downloader.ui

    etc/resources/qsimpleupdater.qrc
)

target_compile_definitions(QSimpleUpdater PRIVATE
    QSU_INCLUDE_MOC=1
)

target_link_libraries(QSimpleUpdater Qt6::Core Qt6::Widgets Qt6::Gui Qt6::Network)
target_include_directories(QSimpleUpdater PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
